package com.cloudkinto.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cloudkinto.entity.ProductStockRackDo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author hua
 * @since 2024-10-28
 */
public interface ProductStockRackDao extends BaseMapper<ProductStockRackDo> {
    List<ProductStockRackDo> getFirstInFirstOutByProductId(
            @Param("tenantId") Long tenantId,
            @Param("whId") Long whId,
            @Param("productId") Long productId,
            @Param("forecastQty") Integer forecastQty,
            @Param("rackId") Long rackId
    );

    List<ProductStockRackDo> getFirstInFirstOutByBoxTypeNumber(
            @Param("tenantId") Long tenantId,
            @Param("whId") Long whId,
            @Param("companyId") Long companyId,
            @Param("boxTypeNumber") String boxTypeNumber,
            @Param("forecastBoxQty") Integer forecastBoxQty,
            @Param("rackId") Long rackId
    );
//    IPage<SkuStockPageDto> stockSkuList(@Param("map")IPage<SkuStockPageDto> page, @Param("map")Map<String, Object> map);


    int updateStock(Long id, int qty);

    /**
     * 锁定库存 -> 增加库存
     */
    int updateStock1(Long id, int qty, int lockQty);


    int lockStock(Long id, int qty);

    int reLockStock(Long id, int qty);

    int reduceBadLockStock(Long id, int qty);

}
